package com.example.systemserver.Controller;

import com.example.systemserver.Bean.AccountBean;
import com.example.systemserver.Bean.ResultBean;
import com.example.systemserver.Service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j

@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService accountService;

    @RequestMapping("/login")
    public ResultBean login(@RequestBody AccountBean accountBean){
        log.info("/account/login,登录，请求参数:{}", accountBean);
        String token = accountService.login(accountBean);
        accountService.login(accountBean);
        log.info("/account/login,登录,返回结果:{}",token);
        return new ResultBean(200, "登录成功", token);
    }
}

